package com.itcast.web;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itcast.constant.MessageConstant;
import com.itcast.entity.Result;
import com.itcast.pojo.Setmeal;
import com.itcast.service.SetmealService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import redis.clients.jedis.JedisPool;

import java.util.UUID;


@RestController
@RequestMapping("setmeal")
public class SetmealController {
    @Autowired
    JedisPool jedisPool;
    @Reference
    SetmealService setmealService;

    //查询套餐
    @RequestMapping("getSetmeal")
    public Result getSetmeal() {

        return setmealService.getSetmeal();

    }

    //套餐详情
    @RequestMapping("findById")
    public Result findById(Integer id) {

        try {
            Setmeal setmeal = setmealService.findByid(id);
            return Result.success(MessageConstant.QUERY_SETMEAL_SUCCESS, setmeal);
        } catch (Exception e) {
            e.printStackTrace();
            return Result.error(MessageConstant.QUERY_SETMEAL_FAIL);
        }

    }



}
